#include "def.h"
#include "option.h"
#include "2440addr.h"     
#include "2440lib.h"
#include "2440slib.h"     
#include "mmu.h" 


#include "raw_api.h"

#include <lib_string.h>

extern unsigned int read_cpsr(void);
extern void exception_vector(void);

extern void MMU_EnableDCache(void);
extern void MMU_EnableICache(void);

#define DATA_ABORT_ERROR *(unsigned int *)0x33d00001

extern void task_test1(void);
extern void qp_test(void);
extern void uip_test(void);
extern void lwip_ping_test(void);
extern void gui_test(void);
extern void gui_demo(void);
extern void rsh_test(void);
extern void nor_flash_s29al016j_test(void);
extern void norflash_en29lv160ab_test(void);
extern void fatfs_test(void);
extern void sd_test(void);
extern void rtc_test(void);
extern void iic_test(void);
extern void watchdog_test(void);
RAW_U8 test_started;

int test_data = 99;

int Main(void)
{
	unsigned int cpsr_state;

	
	cpsr_state = read_cpsr();
	Uart_Printf("Be careful cpsr is %x\n", cpsr_state);
	Uart_Printf("test_data is %d\n", test_data++);

	raw_memcpy((void *)0, (void *)(exception_vector), 128);
	
	MMU_DisableMMU();
	MMU_EnableDCache();
	MMU_EnableICache();

	inerrupt_vector_init();
	
	raw_os_init();	
	
	//task_test1();
	
	//qp_test();

	//uip_test();

	//lwip_ping_test();

	//nor_flash_s29al016j_test();
	
	//norflash_en29lv160ab_test();
	
	//fatfs_test();
	
	//sd_test();
	
	//rtc_test();
	
	//iic_test();
	
	//watchdog_test();
	
 	//gui_test();

	//gui_demo();

	rsh_test();

	raw_os_start();
	
	return 0;
  
}

